package com.ting.etp.host.autoconfig;

import com.ting.etp.host.loader.EtpDefaultPluginLoader;
import com.ting.etp.host.loader.EtpPluginLoader;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zifang
 */
@Configuration
public class EtpPluginBeanConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public EtpPluginLoader createPluginOperator(EtpPluginAutoConfiguration configuration) {
//        public EtpPluginLoader createPluginOperator(RealizeProvider realizeProvider) {
        EtpPluginLoader pluginOperator = new EtpDefaultPluginLoader(
                applicationContext,
//                realizeProvider,
                configuration
        );
        return new PluginOperatorWrapper(pluginOperator, configuration);
    }
}
